package com.ebupt.migu.music.propagate.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ebupt.migu.propagate.PropagateApproveInfo;
import org.apache.ibatis.annotations.Mapper;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author mechrevo
 */
@Mapper
@DS("mysql_mg")
public interface PropagateApproveMapper extends BaseMapper<PropagateApproveInfo> {
    /**
     *  根据策略id查询
     * @param strategyId
     * @return
     */
    default List<PropagateApproveInfo> qryByStrategyId(String strategyId){
        return this.selectList(new QueryWrapper<PropagateApproveInfo>().lambda().
                eq(PropagateApproveInfo::getStrategyId, strategyId));
    }

    /**
     *  根据策略id删除
     * @param strategyId
     */
    default void delByStrategyId(String strategyId){
        this.delete(new QueryWrapper<PropagateApproveInfo>().lambda().
                eq(PropagateApproveInfo::getStrategyId, strategyId));
    }


    /**
     * 查询指定条件下审批记录条数
     *
     * @param map
     * @return
     */
    public Integer queryApproveRecordsCount(Map<String, Object> map);


    /**
     * 查询审批记录列表
     *
     * @param map
     * @return
     */
    public List<HashMap<String, Object>> queryApproveRecords(Map<String, Object> map);


    /**
     * 查询审批明细
     *
     * @param map
     * @return
     */
    public List<HashMap<String, Object>>  queryRankDetail(Map<String, Object> map);



    /**
     * 创建审核记录
     *
     * @param map
     * @return
     */
      void  createApproverDetail(Map<String, Object> map);





}
